<?php

$product = $db->fetchRow("SELECT * FROM shop_products WHERE site_id=? AND id=?", array($site['id'], $_REQUEST['id']));

$db->query("UPDATE shop_products SET deleted=1 WHERE id=?", $product['id']);

if ($product['parent_id']) {
	$location = '../' . $db->fetchOne("SELECT code FROM shop_products WHERE id=?", $product['parent_id']) . '/';
} else {
	$location = '../';
}


header('Content-type: application/json');
echo json_encode(array('ok' => true, 'location' => $location));